#include "stdafx.h"
#include "Board.h"


Board::Board(void)
{
}

//i is y axis, j is x axis (similar to scilab)
std::list<area> Board::findAreas()
{
	std::list<area> ret;
	area *tmp[7];
	for (int i=0; i<7; i++)
	{
		tmp[i]=new area[7];
		for (int j=0; j<7; j++)
		{
			bool found=false;
			if (i!=0 )
			{
				if ( cards[i][j].left && cards[i][j-1].right)
				{
					found=true;
					tmp[i][j]=tmp[i][j-1];
				}
			}
			if (!found && j!=0)
			{
				if ( cards[i][j].up && cards[i-1][j].down)
				{
					found=true;
					tmp[i][j]=tmp[i-1][j];
				}
			}
			if (!found) 
			{
				area addedArea;
				tmp[i][j]=addedArea;
				ret.insert(&addedArea);

			}	
		}
	}
}

Board::~Board(void)
{
}
